package BinaryTree;

/**
 * @author wt
 *
 * @param <T>
 */
public class Node<T> {
	public T data; // 数据域
	public Node<T> left, right; // 左孩子域,右孩子域

	// 构造结点，参数分别指定元素和左、右孩子结点
	public Node(T data, Node<T> left, Node<T> right) {
		this.data = data;
		this.left = left;
		this.right = right;
	}

	public Node(T data) // 构造指定值的叶子结点
	{
		this(data, null, null);
	}

	public Node() {
		this(null, null, null);
	}

	public String toString() {
		return this.data.toString();
	}

	/**
	 * 判断是否叶子结点
	 */
	public boolean isLeaf() {
		return this.left == null && this.right == null;
	}

}
